﻿using IServices;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using System.Linq;
using YL.Core.Dto;
using YL.Core.Entity;
using YL.Core.Entity.Fluent.Validation;
using YL.NetCore.Attributes;
using YL.NetCore.NetCoreApp;
using YL.Utils.Extensions;
using YL.Utils.Pub;
using YL.Utils.Table;

namespace Method.SmartMeter.Controllers
{
    public class DeviceFailureYearController : BaseController
    {
        private readonly IMeter_DeviceFailureMonthServices _DeviceFailureMonthServices;

        public DeviceFailureYearController(IMeter_DeviceFailureMonthServices DeviceFailureMonthServices)
        {
            _DeviceFailureMonthServices = DeviceFailureMonthServices;
        }

        [HttpGet]
        [CheckMenu]
        public IActionResult Index()
        {
            return View();
        }

        [HttpPost]
        [OperationLog(LogType = LogType.select)]
        public ContentResult List([FromForm]Bootstrap.BootstrapParams bootstrap)
        {
            var sd = _DeviceFailureMonthServices.YearPageList(bootstrap, UserDtoCache.UserId);
            return Content(sd);
        }

        [HttpPost]
        [OperationLog(LogType = LogType.select)]
        public ContentResult YearFailureEchart([FromForm]Bootstrap.BootstrapParams bootstrap)
        {
            var sd = _DeviceFailureMonthServices.YearFailureEchart(bootstrap, UserDtoCache.UserId);
            return Content(sd);
        }

    }
}